<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0055)http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#?? -->
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    
    <title>Wiki - 文档/BIPC/RESTAPI</title>
        <link href="./Wiki - 文档_BIPC_RESTAPI_files/custom.css" rel="stylesheet" media="screen, projection" type="text/css">
    <link href="./Wiki - 文档_BIPC_RESTAPI_files/print.css" rel="stylesheet" media="print" type="text/css">
    
    <!--[if IE]><link href="/css/ie.css" rel="stylesheet" media="screen, projection" type="text/css" /><![endif]-->
  </head>
  <body>
    <div id="doc3" class="yui-t1">
        <div id="yui-main">
          <div id="maincol" class="yui-b">
            <div id="userbox">
  <noscript>
    &lt;a href="/_login"&gt;登录&lt;/a&gt;
    &lt;a href="/_logout"&gt;注销&lt;/a&gt;
  </noscript>
  &nbsp;
  <a id="loginlink" class="login" href="http://192.168.5.250/_login" style="display: inline;">登录 / 注册</a>
  <a id="logoutlink" class="login" href="http://192.168.5.250/_logout" style="display: none;">注销 <span id="logged_in_user"></span></a>
</div>
            <ul class="tabs"><li class="selected"><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">view</a></li><li><a href="http://192.168.5.250/_edit/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">edit</a></li><li><a href="http://192.168.5.250/_history/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">history</a></li><li><a href="http://192.168.5.250/_discuss/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">discuss</a></li></ul> 
            <div id="content">
  
  <h1 class="pageTitle"><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">文档/BIPC/RESTAPI</a></h1>
  
  <div id="wikipage"><div id="TOC">
<ul>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#bipc-restful-api">BIPC Restful API</a><ul>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#前言">1.前言</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#用户管理">3.用户管理</a><ul>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#用户注册">用户注册</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#用户更新">用户更新</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#上传头像">上传头像</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#下载头像">下载头像</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#获取用户列表">获取用户列表</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#登录">登录</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#注销">注销</a></li>
</ul></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#患者管理">4.患者管理</a><ul>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#获得患者列表">获得患者列表</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#添加患者">添加患者</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#修改患者">修改患者</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#根据患者id获取患者">根据患者ID获取患者</a></li>
</ul></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#检查">5.检查</a><ul>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#获取检查列表">获取检查列表</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#获取检查信息">获取检查信息</a></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#删除检查信息">删除检查信息</a></li>
</ul></li>
<li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI#分享">6.分享</a></li>
</ul></li>
</ul>
</div>

<h1 id="bipc-restful-api">BIPC Restful API</h1>
<h2 id="前言">1.前言</h2>
<p>此文档描述BIPC所有模块Restful服务接口,包括用法,示例,json请求报文及响应报文标准格式。 用以移动端(包括PC端)与服务端分离开发。 约定: GET:获取对象或者对象列表 POST:新建对象 PUT:更新对象 DELETE:删除对象</p>
令牌:accessToken 认证:AUTH为true的,需要认证信息(传递令牌) ##2.前端验证规则
<pre>GET /checkrules
参数
*category 类别,取值:common,account,study(后续陆续添加),无参数,获取所有类别验证规则
响应:
{
  "head": {
    "success": true,
    "msg": ""
  },
  "content": {
    "common": {
      "mail": {
        "expr": "/^([a-zA-Z0-9_\\.\\-])+@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/",
        "rule": ""
      },
      "mobile": {
        "expr": "/^1(3[0-9]|5[0-35-9]|8[025-9])\\d{8}$/",
        "rule": ""
      }
    },
    "account": {
      "username": {},
      "password": {}
    },
    "study": {}
  }
}
</pre>
<h2 id="用户管理">3.用户管理</h2>
<h3 id="用户注册">用户注册</h3>
<pre>post /user
参数
    name（姓名）、nickname（昵称）、gender（性别）、idcard（身份证号）、mobile（手机号码）、mail（电子邮件）
          username（用户名称）、password（密码）
</pre>
<h3 id="用户更新">用户更新</h3>
<pre>put /user
AUTH true
参数
   name（姓名）、nickname（昵称）、gender（性别）、idcard（身份证号）、mobile（手机号码）、mail（电子邮件）
</pre>
<h3 id="上传头像">上传头像</h3>
<pre>post /portrait
AUTH true
参数
    portrait（头像文件）
</pre>
<h3 id="下载头像">下载头像</h3>
<pre>get /portrait/:id
</pre>
<h3 id="获取用户列表">获取用户列表</h3>
<pre>get /user
AUTH true
</pre>
<h3 id="登录">登录</h3>
<pre>post /signin
参数
    username（用户名称）、password（密码）
响应
    登录成功后，返回accessToken、完整用户信息
    {
      "head": {
        "success": true,
        "msg": ""
      },
      "content": {
        "accessToken": "335a28ce-27bf-46a8-acc2-61d92223528f",
        "user":{
            "id":"ea2a28ce-27bf-46a8-acc2-61d9987430",
            "name":"李明",
            "nickname": "ming",
            "gender":"F|M|U",
            "idcard":"411422198815141210",
            "mobile":"15512101210",
            "mail":"abc@test.com",
            "username":"LM",
        }
      }
    }    
</pre>
<h3 id="注销">注销</h3>
<pre>AUTH true
post /signout
</pre>
<h2 id="患者管理">4.患者管理</h2>
<h3 id="获得患者列表">获得患者列表</h3>
<pre>GET /api/patient
AUTH true
参数:
*userid 用户id
*status 患者状态
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  },
  "content": {
    "pager": {},
    "list": [
      {
        "id": "uuid",
        "name": "王桂英",
        "gender": "F|M|U",
        "birthday": "1957/05/02",
        "relationship": "朋友",
        "idcard": "410801195705021783",
        "userid": "uuid",
        "status": 2
      }
    ]
  }
}
</pre>
<h3 id="添加患者">添加患者</h3>
<pre>POST /api/patient
AUTH true
请求:
{
  "name": "王桂英",
  "gender": "F|M|U",
  "birthday": "1957/05/02",
  "relationship": "朋友",
  "idcard": "410801195705021783",
  "userid": "uuid"
}
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  },
  "content":{
    id": "uuid"
  }
}
</pre>
<h3 id="修改患者">修改患者</h3>
<pre>PUT /api/patient
AUTH true
请求:
{
  "id":"uuid",
  "name": "王桂英",
  "gender": "F|M|U",
  "birthday": "1957/05/02",
  "relationship": "朋友",
  "idcard": "410801195705021783"
}
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  }
}
</pre>

<h3 id="根据患者id获取患者">根据患者ID获取患者</h3>
<pre>GET /api/patient/:pid
AUTH true
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  },
  "content": {
    "id": "uuid",
    "name": "王桂英",
    "gender": "F|M|U",
    "birthday": "1957/05/02",
    "relationship": "朋友",
    "idcard": "410801195705021783",
    "userid": "uuid",
    "status": 2
  }
}
</pre>
<pre>###删除患者
DELETE /api/patient/:pid
AUTH true
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  }
}
</pre>

<h2 id="检查">5.检查</h2>
<h3 id="获取检查列表">获取检查列表</h3>
<pre>GET /api/study  
AUTH true
参数:
*status 检查状态
*userid 用户Id
*curPage 第几页
*countPerPage 每页多少条
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  },
  "content": {
    "pager": {
      "curPage": 3,
      "totalPage": 21,
      "totalCount": 215,
      "countPerPage": 10
    },
    "list": [
      {
        "id": "uuid",
        "pid": "uuid",
        "study_instance_uid": "study instance uid",
        "patient_id": "patient id",
        "name": "严伟",
        "patientage": "029Y",
        "gender": "F|M|U",
        "check_item": "腹部彩超",
        "bodypart": "肾肝脾",
        "modality": "US",
        "studydesc": "",
        "studydate": "2015/05/12",
        "status": 2
      }
    ]
  }
}
</pre>  

<h3 id="获取检查信息">获取检查信息</h3>
<pre>GET /api/study/:id
AUTH true
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  },
  "content": {
    "id": "uuid",
    "pid": "uuid",
    "study_instance_uid": "study instance uid",
    "patient_id": "patient id",
    "name": "严伟",
    "patientage": "029Y",
    "gender": "F|M|U",
    "check_item": "腹部彩超",
    "bodypart": "肾肝脾",
    "modality": "US",
    "studydesc": "",
    "studydate": "2015/05/12",
    "status": 2
  }
}
</pre>
<h3 id="删除检查信息">删除检查信息</h3>
<pre>DELETE /api/study/:id
AUTH true
响应:
{
  "head": {
    "success": true,
    "msg": "success message|error message"
  }
}
</pre>
<h2 id="分享">6.分享</h2>
<pre>post /share
AUTH true
参数
    study_instance_uid（影像id）、type（分享类型）
</pre><div id="categoryList"><ul><li><a href="http://192.168.5.250/_category/BIPC">BIPC</a></li></ul></div></div>
</div>
            <div id="footer">powered by <a href="http://github.com/jgm/gitit/tree/master/">gitit</a></div>
          </div>
        </div>
        <div id="sidebar" class="yui-b first">
          <div id="logo">
  <a href="http://192.168.5.250/" alt="site logo" title="Go to top page"><img src="./Wiki - 文档_BIPC_RESTAPI_files/logo.png"></a>
</div>
                      <div class="sitenav">
  <fieldset>
    <legend>Wiki</legend>
    <ul>
      <li><a href="http://192.168.5.250/">首页</a></li>
      <li><a href="http://192.168.5.250/_index">全部</a></li>
      <li><a href="http://192.168.5.250/_categories">分类</a></li>
      <li><a href="http://192.168.5.250/_random">随机</a></li>
      <li><a href="http://192.168.5.250/_activity">最近</a></li>
              <li><a href="http://192.168.5.250/_upload">上传</a></li>
      
      
      <li><a href="http://192.168.5.250/Help">帮助</a></li>
    </ul>
    <form action="http://192.168.5.250/_search" method="get" id="searchform">
     <input type="text" name="patterns" id="patterns">
     <input type="submit" name="search" id="search" value="搜索">
    </form>
    <form action="http://192.168.5.250/_go" method="post" id="goform">
      <input type="text" name="gotopage" id="gotopage">
      <input type="submit" name="go" id="go" value="Go">
    </form>
  </fieldset>
</div>
          
                      <div class="pageTools">
  <fieldset>
    <legend>本页</legend>
    <ul>
      <li><a href="http://192.168.5.250/_showraw/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">源码</a></li>
      <li><a href="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI?printable">预览</a></li>
      <li><a href="http://192.168.5.250/_delete/%e6%96%87%e6%a1%a3/BIPC/RESTAPI">删除</a></li>
      
    </ul>
    <form action="http://192.168.5.250/%e6%96%87%e6%a1%a3/BIPC/RESTAPI" method="post" id="exportbox"><select name="format"><option value="LaTeX">LaTeX</option><option value="ConTeXt">ConTeXt</option><option value="Texinfo">Texinfo</option><option value="reST">reST</option><option value="Markdown">Markdown</option><option value="Plain text">Plain text</option><option value="MediaWiki">MediaWiki</option><option value="Org-mode">Org-mode</option><option value="ICML">ICML</option><option value="Textile">Textile</option><option value="AsciiDoc">AsciiDoc</option><option value="Man page">Man page</option><option value="DocBook">DocBook</option><option value="DZSlides">DZSlides</option><option value="Slidy">Slidy</option><option value="S5">S5</option><option value="EPUB">EPUB</option><option value="ODT">ODT</option><option value="DOCX">DOCX</option><option value="RTF">RTF</option></select>&nbsp;<input type="submit" name="export" id="export" value="Export"></form>
  </fieldset>
</div>
          
          
        </div>
    </div>
    <script src="./Wiki - 文档_BIPC_RESTAPI_files/jquery.min.js" type="text/javascript"></script><script src="./Wiki - 文档_BIPC_RESTAPI_files/jquery-ui.packed.js" type="text/javascript"></script><script src="./Wiki - 文档_BIPC_RESTAPI_files/footnotes.js" type="text/javascript"></script><script src="./Wiki - 文档_BIPC_RESTAPI_files/MathMLinHTML.js" type="text/javascript"></script>
    
    <script type="text/javascript">
/* <![CDATA[ */
  $.get("/_user", {}, function(username, status) {
     $("#logged_in_user").text(username);
     if (username == "") {  // nobody logged in
        $("#logoutlink").hide();
        $("#loginlink").show();
     } else {
        $("#logoutlink").show();
        $("#loginlink").hide();
     };
   });
/* ]]> */
</script>
  
</body></html>